<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="grid"/>
<sys:header title="会员信息管理" extLibs="${extLibs}" />
<div id="importBox" class="hide">
	<form id="importForm" action="${ctx}/mdm/member/import" method="post" enctype="multipart/form-data"
		  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<div class="form-group"><input id="uploadFile" name="file" type="file" style="width:350px"/><br/>
			<input id="btnImportSubmit" class=""  type="submit" value="   导    入   "/>
			<a href="${ctx}/mdm/member/import/template">下载模板</a>
		</div>

	</form>
</div>
<div class="portlet box ${boxStyleColor}">
	<div class="portlet-title">
		<div class="caption"><i class="icon-users"></i> 会员信息管理</div>
		<div class="actions">
			<a href="#" class="btn btn-default btn-sm" id="btnSearch" title="查询"><i class="fa fa-search"></i> 查询</a>
			<shiro:hasPermission name="mdm:member:edit">
				<a href="${ctx}/mdm/member/form" class="btn btn-default btn-sm btnTool" title="新增会员信息"><i class="fa fa-plus"></i> 新增</a>
				<a href="#" id="btnImport" class="btn btn-default btn-sm" title="导入会员"> <i class="fa fa-pencil-square-o"></i> 导入</a>

			</shiro:hasPermission>
		</div>
	</div>
	<div class="portlet-body list">
		<form:form id="searchForm" modelAttribute="member" action="${ctx}/mdm/member/listData" method="post" class="breadcrumb form-inline hide"
				data-page-no="${page.pageNo}" data-page-size="${page.pageSize}" data-order-by="${page.orderBy}">
			<div class="form-group">
				<label class="control-label">姓名：</label>
				<div class="input-inline">
					<form:input path="memberName" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">性别：</label>
				<div class="input-inline">
					<form:input path="sex" htmlEscape="false" maxlength="1" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">联系电话：</label>
				<div class="input-inline">
					<form:input path="phone" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group" style="margin-left:10px;"> 
				<input class="btn btn-primary btn-sm" type="submit" value="查询"/>&nbsp;
				<input class="btn default btn-sm" type="reset" value="重置"/>
			</div>
		</form:form>
		<table id="dataGrid"></table>
	    <div id="dataGridPage"></div>
	</div>
</div>
<sys:footer extLibs="${extLibs}" />
<script type="text/javascript">
	// 初始化DataGrid对象
	$("#dataGrid").dataGrid({
		
		searchForm: $("#searchForm"), // 数据来源表单
		tabPageId: '${param.tabPageId}',// 当前页签编号
		
		// 设置数据表格列
		columnModel: [
			{header:'工号', name:'memberCode', index:'a.member_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
				return '<a href="${ctx}/mdm/member/form?memberCode='+row.memberCode+'" class="btnList" data-title="编辑会员信息">'+(val ? val : row.id)+'</a>';
			}},
			{header:'姓名', name:'memberName', index:'a.sex', width:120, align:"left"},
			{header:'性别', name:'sex', index:'a.sex', width:60, align:"center"},
			{header:'出生日期', name:'birthday', index:'a.birthday', width:100, align:"center"},
			{header:'工作单位', name:'officeName', index:'a.office_name', width:120, align:"left"},
			{header:'所在分工会', name:'officeName2', index:'a.office_name', width:150, align:"left"},
			{header:'身份证号码', name:'idNo', index:'a.id_no', width:120, align:"left"},
			{header:'联系电话', name:'phone', index:'a.phone', width:100, align:"left"},
			{header:'家庭住址', name:'address', index:'a.address', width:200, align:"left"},
			{header:'更新时间', name:'updateDate', index:'a.update_date', width:120, align:"left",hidden:true},
			{header:'操作', name:'actions', width:100, fixed:true, sortable:false, formatter: function(val, obj, row, act){
				var actions = [];//<shiro:hasPermission name="mdm:member:edit">
				if (row.status == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/mdm/member/form?memberCode='+row.memberCode+'" class="btnList" title="编辑会员信息"><i class="fa fa-pencil"></i></a>&nbsp;');
					actions.push('<a href="${ctx}/mdm/member/delete?memberCode='+row.memberCode+'" class="btnList" title="删除该会员信息" data-confirm="确认要删除该会员信息吗？"><i class="fa fa-trash-o"></i></a>&nbsp;');
				}//</shiro:hasPermission>
				return actions.join('');
			}}
		],
		ajaxSuccess: function(data){ // 加载成功后执行方法
			
		}
	});


	$("#btnImport").click(function(){
		$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
			bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
	});


</script>